import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int[] a={0,5,3,6,7};
        Bubbsort(a,a.length-1);
        System.out.println(Arrays.toString(a));
    }
    public static void Bubbsort(int[] a,int j){ //递归实现冒泡排序
        if(j==0){
            return;
        }
        int x=0;
        for (int i = 0; i < j; i++) {
            if(a[i]>a[i+1]){
                int s=a[i];
                a[i]=a[i+1];
                a[i+1]=s;
                x=i;
            }
        }
        Bubbsort(a,x);
    }
    public static int Binarysearch(int[] a,int target,int left,int right){ //递归实现二分查找
        if(left>=right){
            return -1;
        }
        int m=(left+right)>>1;
        if(a[m]>target){
            return Binarysearch(a,target,left,m-1);
        }
        else if(a[m]<target){
            return Binarysearch(a,target,m+1,right);
        }
        return m;
    }
}